<template>
    <div>
        <!-- 使用此组件实现跳转可以触发页面刷新和进度条效果 -->
        <h1>redirect跳转..</h1>
    </div>
</template>
<script setup name="Redirect">
import { onActivated, nextTick } from 'vue'
import { useRoute, useRouter } from 'vue-router'

const route = useRoute()
const router = useRouter()
// 在组件被激活时执行的操作
onActivated(() => {
    nextTick(() => {
        const { params, query } = route
        const { path } = params
        router.replace({ path: '/' + path, query: query })
    })
})
</script>
